package com.jzo2o.market.service;

import com.jzo2o.api.market.dto.request.CouponUseBackReqDTO;
import com.jzo2o.api.market.dto.request.CouponUseReqDTO;
import com.jzo2o.api.market.dto.response.AvailableCouponsResDTO;
import com.jzo2o.api.market.dto.response.CouponUseResDTO;
import com.jzo2o.common.model.PageResult;
import com.jzo2o.market.model.domain.Coupon;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jzo2o.market.model.dto.request.CouponOperationPageQueryReqDTO;
import com.jzo2o.market.model.dto.request.SeizeCouponReqDTO;
import com.jzo2o.market.model.dto.response.CouponInfoResDTO;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 *  服务类
 * </p> 
 * @author bdfjs
 */
public interface ICouponService extends IService<Coupon> {
    /**
     * 使用优惠券
     * @param couponUseReqDTO
     */
    CouponUseResDTO use(CouponUseReqDTO couponUseReqDTO);
    /**
 * 获取可用优惠券列表
 * @param totalAmount
 * @return
 */
    List<AvailableCouponsResDTO> getAvailable(BigDecimal totalAmount);

    void seizeCoupon(SeizeCouponReqDTO seizeCouponReqDTO);

    PageResult<CouponInfoResDTO> queryForPageOfOperation(CouponOperationPageQueryReqDTO couponOperationPageQueryReqDTO);

    List<CouponInfoResDTO> queryForList(Long lastId, Long userId, Integer status);

    @Transactional(rollbackFor = Exception.class)
    void revoke(Long activityId);

    Integer countReceiveNumByActivityId(Long activityId);

    void processExpireCoupon();

    void useBack(CouponUseBackReqDTO couponUseBackReqDTO);

}